package com.uw.uwrpc.core.api;

import com.uw.uwrpc.core.exception.RpcException;
import lombok.Data;

@Data
public class RpcResponse<T> {

    private boolean status;
    private T data;
    private RpcException ex;


    public static RpcResponse<?> success(Object data) {
        RpcResponse<Object> result = new RpcResponse<>();
        result.setStatus(true);
        result.setData(data);
        return result;
    }

    public static RpcResponse<?> fail(RpcException ex) {
        RpcResponse<?> result = new RpcResponse<>();
        result.setStatus(false);
        result.setEx(ex);
        return result;
    }

}
